package com.aaa.doctor.service.impl;

import com.aaa.doctor.dao.PatientFileDao;
import com.aaa.doctor.service.PatientFileService;
import com.aaa.entity.PatientFile;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class PatientFileServiceImpl implements PatientFileService {

    @Autowired
    private PatientFileDao patientFileDao;

    /**
     * 根据patientID查询患者档案
     * @param patientId
     * @return
     */
    @Override
    public Result<PatientFile> getInfoByPatientId(String patientId) {
        QueryWrapper<PatientFile> wrapper = new QueryWrapper<>();
        if (StringUtils.hasText(patientId)){
            wrapper.eq("patient_Id",patientId);
        }
        PatientFile patientFile = patientFileDao.selectOne(wrapper);
        return new Result<>(200,"查询患者档案成功",patientFile);
    }

}
